package com.apexedu.biz.service.impl;

import com.apexedu.biz.entity.TAccessAppReg;
import com.apexedu.framework.service.impl.AbstractBaseServiceSupport;
import com.apexedu.framework.util.DBUtil;
import com.apexedu.framework.util.Pager;
import org.springframework.stereotype.Service;

import java.util.LinkedList;
import java.util.List;

/**
 * 业务管理导航
 * 主要用于导航各个功能点:用户管理,权限管理,角色管理,系统模块,用户组管理,附加属于,参数设置(界面展示)
 * date:2013.10.12
 * user:liuxu
 */
@Service("systemManagerNavigationService")
public class SystemManagerNavigationServiceImpl extends AbstractBaseServiceSupport {
    
	@SuppressWarnings("unchecked")
	@Override
	public List<?> list(Object myaction, Pager pager) throws Exception {

        List<Object> params = new LinkedList<Object>();
        String sql = " from T_ACCESS_APP_REG t where 1=1 ";

        long c = DBUtil.count("select count(*) as c " + sql, params.toArray());
        pager.setTotalRows(c);
        //hql.append(" order by ordernum desc");
        StringBuilder hql_column = new StringBuilder("select appid,appname,appcode,appurl,(select zdmc from T_SYS_CODE where zdlb='BOOLEAN' and zdbm=t.state) as stateText,memo ");
        hql_column.append(sql);
        List<TAccessAppReg> list = DBUtil.queryPageBeanList(pager, hql_column.toString(), TAccessAppReg.class, params.toArray());
        return list;
	}

    @Override
    public void saveOrUpdate(Object myaction) throws Exception {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public void load(Object myaction) throws Exception {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public boolean remove(Object myaction) throws Exception {
        return false;  //To change body of implemented methods use File | Settings | File Templates.
    }
}
